package com.zznj.xzjc.adapter.index;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zznj.xzjc.R;
import com.zznj.xzjc.bean.index.HdlxData;
import com.zznj.xzjc.bean.index.XsglData;
import com.zznj.xzjc.utils.StringUtils;
import com.zznj.xzjc.utils.TimeUtils;

import java.sql.Time;
import java.util.List;

/**
 * 描述：添加类的描述
 *
 * @author wx5e48d604c2885118
 * @time 2020/4/7
 */
public class HdlxAdapter extends BaseQuickAdapter<HdlxData, BaseViewHolder> {
    private int type;
    public HdlxAdapter(int layoutResId, @Nullable List<HdlxData> data, int type) {
        super(layoutResId, data);
        this.type = type;
    }

    @Override
    protected void convert(BaseViewHolder helper, HdlxData item) {
        helper.setText(R.id.title,item.getTitle())
                .setText(R.id.content,StringUtils.delHtmlAllSigh(item.getContent()))
                .setText(R.id.lrdw, "接收单位："+item.getReceiveOrgName())
                .setText(R.id.time, TimeUtils.computeFromNowStr(item.getSendTime()));
        ImageView logo = helper.getView(R.id.logo);
        if(type == 0){
            logo.setImageResource(R.mipmap.ic_dhf_logo);
        }else{
            logo.setImageResource(R.mipmap.ic_yhf_logo);
        }
    }
}
